<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/mayioa/css/mayioa-ui.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/datapicker/datepicker3.css}" rel="stylesheet"/>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-plan-eva-edit" th:object="${planCustom}">
			<input name="planCusId"  type="hidden"  th:field="*{planCusId}" />

			<div class="form-group">
				<label class="col-sm-3 control-label">自定义项名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="planCusName" id="planCusName" th:field="*{planCusName}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">通过分数：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="planCusPassScore" id="planCusPassScore" th:field="*{planCusPassScore}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">总分数：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="planCusTotalScore" id="planCusTotalScore" th:field="*{planCusTotalScore}">
				</div>
			</div>
		</form>
	</div>
	<div th:include="include::footer"></div>
	<script th:src="@{/ajax/libs/select/select2.js}"></script>
	<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
	<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
	<script th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
	<script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
	<script>

        $("#form-plan-eva-edit").validate({
        	rules:{
        		planCusName:{
        			required:true
        		},
        		planCusPassScore:{
        			required:true,
        			number:true
        		},
        		planCusTotalScore:{
        			required:true,
        			number:true
        		}
        	}
        });
        
        function submitHandler() {
	        if ($.validate.form()) {
	        	edit();
	        }
	    }

        function edit() {
        	var planCusId = $("input[name='planCusId']").val();
        	var planCusName = $("input[name='planCusName']").val();
        	var planCusPassScore = $("input[name='planCusPassScore']").val();
        	var planCusTotalScore = $("input[name='planCusTotalScore']").val();

        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "plan/evaluation/edit",
        		data : {
        			"planCusId": planCusId,
        			"planCusName": planCusName,
        			"planCusPassScore": planCusPassScore,
        			"planCusTotalScore": planCusTotalScore
        		},
        		async : false,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }

    </script>
</body>
</html>
